﻿<!-- Link to Google CDN's jQuery + jQueryUI; fall back to local -->
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
<script>if (!window.jQuery) { document.write('<script src="/scripts/libs/jquery-3.4.1.min.js"   ><\/script>'); }</script>
<!---script src="~/Scripts/libs/jquery-ui-1.12.1.noConflict.min.js"></script-->
<!-- PACE LOADER - turn this on if you want ajax loading to show (caution: uses lots of memory on iDevices)-->
<script src="~/Scripts/smartadmin.easyui.min.js"></script>
@Html.LangScriptTag("/Scripts/easyui/locale/easyui-lang-zh_CN.js")
@Scripts.Render("~/plugins/jquerydatasourceformatterjs")


<!-- IMPORTANT: SmartAdmin Core -->
<script src="~/Scripts/smartadmin.min.js"></script>


<!-- Voice command : plugin -->
@*<script src="~/scripts/speech/voicecommand.js"></script>*@

<!--Reference the autogenerated SignalR hub script. -->
@*<script src="~/signalr/hubs"></script>*@


@if (Request.IsAuthenticated)
{
  <!-- SmartChat UI : plugin -->
  @*<script src="~/Scripts/smart-chat-ui/smart.chat.min.js"></script>*@

}
@if (@Model is HelperResult)
{
  @Model
}
<!-- DO NOT REMOVE : GLOBAL FUNCTIONS! -->
<script type="text/javascript">

  paceOptions = {
    // Disable the 'elements' source
    elements: false,
    ajax: false, // disabled
    document: false, // disabled
    eventLag: false, // disabled
    // Only show the progress on regular and ajax-y page navigation,
    // not every request
    restartOnRequestAfter: false
  }
  Pace.on('start', function () { $('#wid-id-0 div').children('.widget-body').addClass('sk-loading'); });
  Pace.on('done', function () { $('#wid-id-0 div').children('.widget-body').removeClass('sk-loading'); });


  $(document).ready(function () {
    window.paceOptions = {
      ajax: false,
      eventLag: false,
      elements: false
    }　
    pageSetUp();
    drawBreadCrumb();
    window.addEventListener('beforeunload', function (e) {
      //e.preventDefault();
      //if (hook) {
      //  e.returnValue = '';
      //  return '提示';
      //}
    });
    toastr.options = {
      "closeButton": true,
      "debug": false,
      "newestOnTop": false,
      "progressBar": true,
      "positionClass": "toast-bottom-right",
      "preventDuplicates": false,
      "onclick": null,
      "showDuration": "300",
      "hideDuration": "1000",
      "timeOut": "2000",
      "extendedTimeOut": "1000",
      "showEasing": "swing",
      "hideEasing": "linear",
      "showMethod": "fadeIn",
      "hideMethod": "fadeOut"
    }

    JoelPurra.PlusAsTab.setOptions({
      // Use enter instead of plus
      // Number 13 found through demo at
      // https://api.jquery.com/event.which/
      key: 13
    });

    
    
  });
  //提示是否保存数据
  var hook = false;
</script>

<script type="text/javascript">

  $(document).ajaxError((event, request, ajaxOptions, exception) => {
    console.error(event, request, ajaxOptions, exception);
    var message;
    var url = ajaxOptions.url;
    var type = event.type;
    var method = ajaxOptions.type;
    var statusErrorMap = {
      '400': "Server understood the request, but request content was invalid.",
      '401': "Unauthorized access.",
      '403': "Forbidden resource can't be accessed.",
      '404': "Not Found.",
      '500': "Internal server error.",
      '503': "Service unavailable."
    };
    if (request.status) {
      message = statusErrorMap[request.status];
      if (!message) {
        message = "Unknown Error \n.";
      }
    } else if (exception === 'parsererror') {
      message = "Error.\nParsing JSON Request failed.";
    } else if (exception === 'timeout') {
      message = "Request Time out.";
    } else if (exception === 'abort') {
      message = "Request was aborted by the server";
    } else {
      message = "Unknown Error \n.";
    }
    toastr.warning(`${method}:${url} <br> ${message} <br> 请联系管理员  <i class='fa fa-envelope-o' aria-hidden='true'></i> : demo@admin.com`, { positionClass: 'toast-bottom-right' });
  });



</script>


